import hashlib
from django.conf import settings

def sha(str_data):
    #盐加数据
    sha = hashlib.sha256(str_data.encode())
    #对密码加密
    return sha.hexdigest()

if __name__=='__main__':
    md5_pwd = sha('123456')
    print(md5_pwd)